Gbp-Pq: Name Wait-for-device-name-to-appearr-before-mount-mkfs.patch
CLEANUP_FREE char *err = NULL;
int extfs = 0;
+ /* Wait up to 15s for device to appear */
+ for (int j=0; i < 150; i++) {
+ if (!access (device, F_OK)) {
+ break;
+ }
+ usleep(100000);
+ }
+
if (fstype_is_extfs (fstype))
extfs = 1;
let args = ref [] in
+ (* Wait up to 15s for device to appear *)
+ (match mountable.m_type with
+ | MountableDevice | MountablePath ->
+ if String.starts_with "/dev/" mountable.m_device then
+ let i = ref 0 in
+ while (not (Sys.file_exists mountable.m_device)) && (!i < 150) do
+ Unix.sleepf 0.1;
+ i := !i + 1;
+ done
+ | _ -> ()
+ );
+
(* -o options *)
(match options, mountable.m_type with
| "", (MountableDevice | MountablePath) -> ()